﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace ADEVSO.Util
{
    public class Image
    {
        ///// <summary>
        ///// Load image from Byte Array
        ///// </summary>
        ///// <param name="imageBytes"></param>
        ///// <returns></returns>
        //public static Bitmap LoadImage(byte[] imageBytes)
        //{
        //    // Open a stream for the image and write the bytes into it
        //    System.IO.MemoryStream imageStream = new System.IO.MemoryStream(imageBytes, true);
        //    imageStream.Write(imageBytes, 0, imageBytes.Length);
        //    // Create a bitmap from the stream
        //    Bitmap image = new Bitmap(imageStream);
        //    // Close the stream
        //    imageStream.Close();

        //    return image;
        //}

        ///// <summary>
        ///// Load image from Byte Array
        ///// </summary>
        ///// <param name="imageBytes"></param>
        ///// <param name="width"></param>
        ///// <param name="height"></param>
        ///// <returns></returns>
        //public static Bitmap LoadImage(byte[] imageBytes, int width, int height)
        //{
        //    return ResizeBitmap(LoadImage(imageBytes), width, height);
        //}

        ///// <summary>
        ///// Load image from URL
        ///// </summary>
        ///// <param name="imageURL"></param>
        ///// <returns></returns>
        //public static byte[] LoadImage(String imageURL)
        //{
        //    // Create a new stream to load this image into
        //    System.IO.FileStream stream = new System.IO.FileStream(imageURL, System.IO.FileMode.Open, System.IO.FileAccess.Read);
        //    // Create a buffer to hold the stream bytes
        //    byte[] imageBytes = new byte[stream.Length];
        //    // Read bytes from stream
        //    stream.Read(imageBytes, 0, (int)stream.Length);
        //    // Close the stream
        //    stream.Close();

        //    return imageBytes;
        //}

        ///// <summary>
        ///// Resize Existing Bitmap
        ///// </summary>
        ///// <param name="bitmap"></param>
        ///// <param name="width"></param>
        ///// <param name="height"></param>
        ///// <returns></returns>
        //private static Bitmap ResizeBitmap(Bitmap bitmap, int width, int height)
        //{
        //    return new Bitmap(bitmap, new Size(width, height));
        //}
    }
}
